package com.lambda;

import com.siyue.bean.Student;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class 计算 {

    private static List<Student> studentList = new ArrayList<>();

    static {
        studentList.add(new Student("小红", 13, 2));
        studentList.add(new Student("张三", 20, 1));
        studentList.add(new Student("王五", 9, 1));
        studentList.add(new Student("小明", 24, 1));

    }

    /**
     * 获取年龄最大值
     */
    @Test
    public void test1(){
        Integer maxAge= studentList.stream().max(Comparator.comparing(Student::getAge)).get().getAge();
        System.out.println(maxAge);
    }

}




